package cn.com.cis.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cis.domain.TreeEntity;
import cn.com.cis.persistence.TreeMapper;

@Service
@Transactional
public class TreeService {

	@Autowired
	private TreeMapper mapper;

	@Transactional(readOnly = true)
	public TreeEntity selectTreeById(int id) {
		return mapper.selectTreeById(id);
	}

	@Transactional(readOnly = true)
	public TreeEntity selectTreeBypIdAndConnID(TreeEntity tree) {
		return mapper.selectTreeBypIdAndConnID(tree);
	}

	public List<TreeEntity> selectTreeByPid(int id) {
		return mapper.selectTreeByPid(id);
	}

	public void insertTree(TreeEntity tree) {
		mapper.insertTree(tree);
	}

	public void deleteTree(int id) {
		mapper.deleteTree(id);
	}

	public void updateTree(TreeEntity tree) {
		mapper.updateTree(tree);
	}

	public int saveVal(TreeEntity tree) {
		return mapper.saveVal(tree);
	}

	public int saveConnectID(TreeEntity tree) {
		return mapper.saveConnectID(tree);
	}

	public int saveNodeContent(TreeEntity tree) {
		return mapper.saveNodeContent(tree);
	}

	public String GetMaxIDByPid(int pid) {
		return mapper.GetMaxIDByPid(pid);
	}

	public int updateTreeNode(TreeEntity tree) {
		return mapper.updateTreeNode(tree);
	}

	@Transactional(readOnly = true)
	public List<TreeEntity> selectAllTree() {
		return mapper.selectAllTree();
	}

	public int deleteTreeByPid(int jobid) {
		return mapper.deleteTreeByPid(jobid);
	}

	public int deleteTreeByIdAndPid(int nodeid) {
		return mapper.deleteTreeByIdAndPid(nodeid);
	}

	public int UpdateNodeName(TreeEntity treeEntity) {
		return mapper.UpdateNodeName(treeEntity);
	}

	public List<TreeEntity> selectJobs() {
		return mapper.selectJobs();
	}
}
